Skip to main content

ComponentTests

Line Chart – Component test plan

Sub-components: Line, x-axis, y-axis, Event, Time Range, Callout, Drop down and Legend

  1. Line: Line data, Line color (multi colors), Line label (show/hide)
  2. Legends: show/hide legends, highlight the corresponding line on legend hover
  3. Callout: Default/custom callout
  4. Labels: x-Axis labels
Test stepsValidationTool used
Test 1: [Snapshot testing]
- With only data prop, numerical data on x-axis.Renders line chart correctlyRTL
- With only data prop, date data on x-axis.Renders line chart correctlyRTL
- With only data prop, string data on x-axis.Should not render area chartPending
- With allowMultipleShapesForPoints set to “true”Should render line chart with multiple shapes for chart pointsRTL
- With HideLegend prop set to “true”Should hide legendsEnzyme
- With HideTooltip prop set to “true”Should hide the tooltip in chartEnzyme
- With EnabledLegendsWrapLines set to “true”Should enable the legends to wrap lines if there is not enough space to show all legends on a single lineEnzyme
- With ShowXAxisLablesTooltip set to “true”Should truncate x axis labels and show tooltip on x axis labelsEnzyme
- With WrapXAxisLables set to “true”Should wrap x axis label valuesEnzyme
- With yAxisTickFormat set to “%d”

Should render the y-axis ticks in the format specified

Enzyme
- With canSelectMultipleLegends set to “true”Should select multiple legendsRTL
Test 2: Basic props testing
- HideLegend prop set to “true”Should not mount legend when hideLegend is trueEnzyme
- HideLegend prop set to “false”Should mount legend when hideLegend is falseEnzyme
- HideTooltip prop set to “true”Should not mount callout when hideTootip is trueEnzyme
- HideTooltip prop set to “false”Should mount callout when hideTootip is falseEnzyme
Test 3: Render calling with respective to props
- No prop changes: Mount line chart and then set the same props againRender function should have been called twiceEnzyme
- Prop changes: Mount line chart and then set some other propRender function should have been called twiceEnzyme
Test 4: Mouse events
- Mouse over on a lineShould render callout correctly on mouseoverEnzyme
- Mouse move from one line to other lineShould render callout correctly on mouse moveEnzyme
- Mouse over on a line with customized calloutShould render customized callout on mouseoverEnzyme
- Customized callout on a lineShould render customized callout correctly on mouseoverEnzyme
- Customized callout on a line from one line to other lineShould render customized callout for stack on mouseoverEnzyme
Test 5: Render empty chart aria label div when chart is empty
- Line chart mounted with non-empty dataNo empty chart aria label div renderedEnzyme
- Line chart mounted with empty dataEmpty chart aria label div renderedEnzyme
Test 6: Render empty chart calling with respective to props
- No prop changes: Mount line chart with non-empty data and then set the same props againRender function should have been called twiceEnzyme
- prop changes: Mount line chart with empty data and then set the propsRender function should have been called 3 timesEnzyme
Test 7: [Sub-Component]: Line
- Specify lines with specified colorsShould render lines with the color provided in dataRTL
- Specify line data with gapsShould render the lines with specified gapsRTL
Test 8: [Sub-Component]: Legends
- Hover mouse over line legendsShould highlight the corresponding line on mouse over on legendRTL
- Mouse leave on legendsShould reset the highlighted line on mouse leave on legendsRTL
- Single mouse click on legendsShould select legend on single mouse click on respective legendRTL
- Double mouse click on legendsShould deselect legend on double mouse click on respective legendRTL
Test 9: [Sub-Component]: Time Range(Color fill bars)
- Line chart with time rangeShould render time range with specified dataRTL
- Single mouse click on time range legendShould highlight corresponding time range on legend clickRTL
Test 10: [Sub-Component]: x-axis labels
- Truncate x-axis labelsShould show the x-axis labels tooltip when hoveredRTL
- Rotate x-axis labelsShould rotate the x-axis labels by 45 degreesRTL
Test 11: [Sub-Component]: Event
- Line chart with Events dataShould render line chart with eventsRTL
Test 12: [Sub-Component]: Screen resolution
- Increase the screen resolution (zoom in)Should remain unchanged on zoom inRTL
- Decrease the screen resolution (zoom out)Should remain unchanged on zoom outRTL
Test 13: Theme changed to Dark ThemeShould reflect theme changeRTL